package org.lwd.datalink.reader.mysql;

import com.alibaba.otter.canal.sink.AbstractCanalEventDownStreamHandler;
import com.alibaba.otter.canal.store.model.Event;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @author lwd
 */
@Slf4j
public class CanalReaderDownStreamHandler extends AbstractCanalEventDownStreamHandler<List<Event>> {

    @Override
    public List<Event> before(List<Event> events) {
        if (log.isDebugEnabled()) {
            events.stream().forEach(e -> {
                log.debug("Event Dump in Handler : EntryType is {}, EventType is {},SchemaName is {},TableName is {}.",
                        e.getEntry().getEntryType(),
                        e.getEntry().getHeader().getEventType(),
                        e.getEntry().getHeader().getSchemaName(),
                        e.getEntry().getHeader().getTableName());
            });
        }
        return super.before(events);
    }
}

